package com.gilgamesh.mall.product.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gilgamesh.mall.product.sql.ShopSql;
import com.gilgamesh.mall.sdk.bean.product.ShopEntity;
import com.gilgamesh.mall.sdk.dto.product.ShopDTO;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import java.util.List;

/**
 * @author yanm
 * @date 2021/1/13 16:34
 **/
@Mapper
public interface ShopDao extends BaseMapper<ShopEntity> {
    @Results(
            id = "shopDTOMap",value = {
            @Result(column = "id" ,jdbcType = JdbcType.BIGINT,javaType = Long.class,property = "id"),
            @Result(column = "shop_name",jdbcType = JdbcType.VARCHAR,javaType = String.class,property = "shopName"),
            @Result(column = "create_time",jdbcType = JdbcType.DATETIMEOFFSET,javaType = java.util.Date.class,property = "createTime"),
            @Result(column = "shop_code" ,jdbcType = JdbcType.VARCHAR,javaType = String.class,property = "shopCode"),
         }
    )

    @SelectProvider(type = ShopSql.class , method = "listShops")
    List<ShopDTO> listShops(ShopEntity shopEntity);

    @Select("select * from t_shop where id =#{id}")
    ShopDTO getShopById(Long id);


}
